package com.ruoyi.exam.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.exam.domain.ExamQuestionOption;
import com.ruoyi.exam.vo.ExamQuestionOptionVo;
import com.ruoyi.exam.mapper.ExamQuestionOptionMapper;
import com.ruoyi.exam.service.IExamQuestionOptionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 题目选项Service业务层处理
 *
 * @author Tellsea
 * @date 2025-05-30
 */
@Service
public class ExamQuestionOptionServiceImpl extends ServiceImpl<ExamQuestionOptionMapper, ExamQuestionOption> implements IExamQuestionOptionService {

    @Override
    public TableDataInfo<ExamQuestionOptionVo> queryList(ExamQuestionOptionVo entity) {
        return PageUtils.buildDataInfo(this.baseMapper.queryList(PageUtils.buildPage(), entity));
    }

    @Override
    public List<ExamQuestionOptionVo> queryAll(ExamQuestionOptionVo entity) {
        return this.baseMapper.queryList(entity);
    }

    @Override
    public ExamQuestionOptionVo queryById(Long optionId) {
        return this.baseMapper.queryById(optionId);
    }

    @Override
    public boolean save(ExamQuestionOptionVo entity) {
        return this.baseMapper.insert(entity) > 0;
    }
}
